import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'
import App from '../App'
import Start from '../pages/startpage/index'
const Login = lazy(() => import('../pages/login/index'))
const Register = lazy(() => import('../pages/register/index'))
const Eeorr = lazy(() => import('../pages/notfound/index'))
// 主要页面路由
const Home = lazy(() => import('../pages/tab/home/index'))
const Circle = lazy(() => import('../pages/tab/circle/index'))
const Kepu = lazy(() => import('../pages/tab/kepu/index'))
const My = lazy(() => import('../pages/tab/my/index'))
const Userset = lazy(() => import('../pages/setUp/userset/index'))
const CircleDetail = lazy(() => import('../pages/tab/circle/detail'))
const Search = lazy(() => import('../pages/allsompage/search/index'))
const Detail = lazy(() => import('../pages/allsompage/Detail/index'))
const Doctor = lazy(() => import('../pages/allsompage/findADoctor/index'))
const DoctorDetail = lazy(() => import('../pages/allsompage/doctordetail/index'))
const Bingzheng = lazy(() => import('../pages/allsompage/bingzheng/index'))
const FollowDoctor = lazy(() => import('../pages/allsompage/followDoctor/index'))
const KeshiDoctor = lazy(() => import('../pages/allsompage/keshidoctor/index'))
const LiveVideo = lazy(() => import('../pages/allsompage/liveVideo/index'))
const AllDepartments = lazy(() => import('../pages/allsompage/allDepartments/index'))
const Chat = lazy(() => import('../pages/chat/index'))

// 一级路由
const router = createBrowserRouter([
    // 重定向
    {
        index: true,
        element: <Start></Start>
    },
    {
        path: '/',
        element: <App />,
        children: [
            {
                path: '/home',
                element: <Home></Home>
            },
            {
                path: '/circle',
                element: <Circle></Circle>
            },
            {
                path: '/kepu',
                element: <Kepu></Kepu>
            },
            {
                path: '/my',
                element: <My></My>
            },
            // 404页面
            {
                path: '*',
                element: <Eeorr></Eeorr>
            }
        ]
    },
    // 启动页面
    {
        path: '/start',
        element: <Start></Start>
    },
    // 登录注册页面
    {
        path: '/login',
        element: <Login></Login>
    },
    {
        path: '/register',
        element: <Register></Register>
    },
    // 对应病症页面
    {
        path:'/bingzheng',
        element:<Bingzheng></Bingzheng>
    },
    // 找医生
    {
        path:'/doctor',
        element:<Doctor></Doctor>
    },
    // 医生详情页
    {
        path:'/doctorDetail',
        element:<DoctorDetail></DoctorDetail>
    },
    // 病友圈详情页
    {
        path:'/circle/detail/:id',
        element:<CircleDetail></CircleDetail>
    },
    // 关注医生列表
    {
        path:'/followDoctor',
        element:<FollowDoctor></FollowDoctor>
    },
    // 科室找医生列表
    {
        path:'/keshiDoctor',
        element:<KeshiDoctor></KeshiDoctor>
    },
    // 全部科室页面
    {
        path:'/allDepartments',
        element:<AllDepartments></AllDepartments>
    },
    // 用户设置
    {
        path:'/userset',
        element:<Userset></Userset>
    },
    // 医生视频直播
    {
        path:'/liveVideo',
        element:<LiveVideo></LiveVideo>
    },
    // 搜索页面
    {
    path:'/search',
        element:<Search></Search>
    },
    {
        path:'/detail',
        element:<Detail></Detail>
    },
    // 聊天页面
    {
        path:'/chat',
        element:<Chat></Chat>
    }
])
export default router